﻿<phone:PhoneApplicationPage 
    x:Class="OcrSampleAppLite.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Microsoft Research Project Hawaii SDK 2.0" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="OCR Client Lite" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="56"/>
        </StackPanel>

        <Grid 
            x:Name="HawaiiAppIdErrorArea"
            Grid.Row="1" 
            Margin="12,20,12,20" 
            Visibility="Collapsed">
            <TextBlock TextWrapping="Wrap">
                <Run>The Azure data market client Id or secret is missing.</Run><LineBreak/><LineBreak/>
                <Run>In order to run this sample you need to</Run><LineBreak/>
                <Run>obtain Adm client Id and sign up Hawaii service from</Run><LineBreak/>
                <Run>http://datamarket.azure.com</Run><LineBreak/>
                <Run>Use that Id in the source file HawaiiClient.cs</Run>
            </TextBlock>
        </Grid>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="10">

            <Button x:Name="btnTakePicture" Width="400" Height="400" Click="TakePicture_Click">
                <Image Source="TakePhoto.png" />
            </Button>

            <Grid x:Name="photoArea" Visibility="Collapsed" >
                <Image x:Name="imgPhoto"/>
                <Border 
                    HorizontalAlignment="Center"
                    VerticalAlignment="Bottom"
                    Background="{StaticResource PhoneChromeBrush}" Opacity="0.7" >
                    <TextBlock 
                        Text="Converting... Please Wait" 
                        FontSize="24"
                        Margin="10,5,10,5" />
                </Border>
            </Grid>

            <Grid x:Name="resultArea" Visibility="Collapsed">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                
                <TextBlock 
                    x:Name="txtResult" 
                    Grid.Row="0"
                    FontSize="24"
                    TextWrapping="Wrap"
                    Visibility="Collapsed" />

                <TextBlock 
                    x:Name="txtEmptyResult" 
                    Grid.Row="0"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Foreground="Yellow"
                    FontSize="24"
                    Text="[No text was found]"
                    Visibility="Collapsed" />

                <TextBlock 
                    x:Name="txtError" 
                    Grid.Row="0"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Foreground="Red"
                    FontSize="24"
                    TextWrapping="Wrap"
                    Visibility="Collapsed" />
                
                <Button 
                    Grid.Row="1"
                    Content="Try Again" 
                    Click="TryAgain_Click"
                    Padding="20,10,20,10"
                    VerticalAlignment="Bottom"  
                    HorizontalAlignment="Center" />
            </Grid>

        </Grid>
    </Grid>

</phone:PhoneApplicationPage>